import 'package:flutter/material.dart';
import 'package:myapp/dio/model/hitokoto.dart';

class WiseSaying extends StatefulWidget {
  final Hitokoto hitokoto;
  const WiseSaying({super.key, required this.hitokoto});

  @override
  State<WiseSaying> createState() => _WiseSayingState();
}

class _WiseSayingState extends State<WiseSaying> {
  @override
  Widget build(BuildContext context) {
    return Container(
      margin: const EdgeInsets.symmetric(vertical: 20, horizontal: 30),
      padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
      width: double.infinity,
      decoration: BoxDecoration(
        // image: const DecorationImage(
        //   image: NetworkImage(
        //       'https://storage.taoqilin.cn/blog/66189ab0-bb8f-11ee-a9f3-6507eddc2e21'),
        //   fit: BoxFit.cover,
        // ),

        borderRadius: BorderRadius.circular(10), // 边框圆角
        border: Border.all(
          color: Colors.blue, // 边框颜色
          width: 2, // 边框宽度
        ),
      ),
      foregroundDecoration: BoxDecoration(
        // color: Colors.black.withOpacity(0.5), // 添加半透明黑色遮罩
        borderRadius: BorderRadius.circular(10), // 边框圆角
      ),
      child: Column(
        children: [
          const Text('每日一言'),
          Container(
            margin: const EdgeInsets.only(top: 10),
            width: double.infinity,
            alignment: Alignment.topLeft,
            child: Text(widget.hitokoto.hitokoto),
          ),
          Container(
              width: double.infinity,
              alignment: Alignment.bottomRight,
              child: Text(
                  '————${widget.hitokoto.from}${widget.hitokoto.fromWho != null ? ":${widget.hitokoto.fromWho}" : ''}')),
        ],
      ),
    );
  }
}
